Check host.getType() to detect GraphQL context and throw a GraphQLError instead of sending an HTTP response. For REST, send the standard HTTP response. Use GqlArgumentsHost.create(host) to access the GraphQL execution context. Map HTTP status codes to GraphQL error codes like UNAUTHENTICATED and FORBIDDEN.
GraphQL always returns HTTP 200 — errors go in the errors array of the response body.
Throw GraphQLError inside the filter for GraphQL context — NestJS serializes it correctly.
Use GqlArgumentsHost.create(host) to access the GraphQL info, args, and context.
Map HTTP status codes to GraphQL error codes: 401 to UNAUTHENTICATED, 403 to FORBIDDEN.
host.getType() returns 'graphql' for GraphQL resolvers when @nestjs/graphql is configured.